package cn.alise.qdp.service.admin;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import cn.alise.qdp.mapper.admin.RoleMapper;
import cn.alise.qdp.model.role.Role;

@Service
@Transactional(rollbackFor = Exception.class)
public class RoleService {

	@Resource(name = "roleMapper")
	private RoleMapper roleMapper;
	
	public Role get(Role args) {
		List<Role> list = this.list(args);
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}
		
		return null;
	}
	
	public List<Role> gets(Map<String, Object> args){
		return this.roleMapper.gets(args);
	}
	
	public List<Role> list(Role args) {
		return this.roleMapper.list(args);
	}
	
	public List<Role> page(Map<String, Object> args) {
		return this.roleMapper.page(args);
	}
	
	public int total(Role args) {
		return this.roleMapper.total(args);
	}
	
	public int delete(Role args) {
		return this.roleMapper.delete(args);
	}
	
	public int save(Role args) {
		return this.roleMapper.insert(args);
	}
	
	public int update(Role args) {
		return this.roleMapper.update(args);
	}
}
